﻿using UnityEngine;

namespace SoarD.Pandora.Console
{
    public partial class PdrConsoleWindow
    {
        private sealed class SystemInfoWindow : ScrollWindowBase
        {
            protected override void OnDrawScrollableWindow()
            {
                GUILayout.Label("<b>系统信息</b>");
                GUILayout.BeginVertical("box");
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUI.skin.box.fontSize = 30;
                        GUI.skin.box.alignment = TextAnchor.MiddleLeft;
                        if (GUILayout.Button("设备分数:", "box", GUILayout.Width(TitleWidth)))
                            PdrAnalyzer.CaclScore();
                        GUILayout.Label(PdrAnalyzer.DeviceScore.ToString("f1"));
                    }
                    GUILayout.EndHorizontal();

                    DrawItem("设备uid:", SystemInfo.deviceUniqueIdentifier);
                    DrawItem("设备名:", SystemInfo.deviceName);
                    DrawItem("设备型号:", SystemInfo.deviceType.ToString());
                    DrawItem("设备模型:", SystemInfo.deviceModel);
                    DrawItem("处理器类型:", SystemInfo.processorType);
                    DrawItem("处理器数量:", SystemInfo.processorCount.ToString());
                    DrawItem("处理器主频:", string.Format("{0} MHz", SystemInfo.processorFrequency));
                    DrawItem("内存大小:", string.Format("{0} MB", SystemInfo.systemMemorySize));
                    DrawItem("操作系统系列:", SystemInfo.operatingSystemFamily.ToString());
                    DrawItem("操作系统:", SystemInfo.operatingSystem);
                    DrawItem("支持音频:", SystemInfo.supportsAudio.ToString());
                    DrawItem("支持定位:", SystemInfo.supportsLocationService.ToString());
                    DrawItem("支持加速度:", SystemInfo.supportsAccelerometer.ToString());
                    DrawItem("支持陀螺仪:", SystemInfo.supportsGyroscope.ToString());
                    DrawItem("支持触摸震动:", SystemInfo.supportsVibration.ToString());
                }
                GUILayout.EndVertical();
            }

            //        SystemInfo.batteryStatus
            //            SystemInfo.batteryLevel
            //        private string GetBatteryLevelString(float batteryLevel)
            //        {
            //            if (batteryLevel < 0f)
            //            {
            //                return "Unavailable";
            //            }
            //
            //            return batteryLevel.ToString("P0");
            //        }
        }
    }
}
